home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- import java.lang.ref.ReferenceQueue;
- import java.util.AbstractMap;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.Set;
-
- public class SoftCache extends AbstractMap implements Map {
- private Map hash;
- private ReferenceQueue queue = new ReferenceQueue();
- private Set entrySet = null;
-
- private void processQueue() {
- ValueCell var1;
- while((var1 = (ValueCell)this.queue.poll()) != null) {
- if (sun.misc.SoftCache.ValueCell.access$000(var1)) {
- this.hash.remove(sun.misc.SoftCache.ValueCell.access$100(var1));
- } else {
- sun.misc.SoftCache.ValueCell.access$210();
- }
- }
-
- }
-
- public SoftCache(int var1, float var2) {
- this.hash = new HashMap(var1, var2);
- }
-
- public SoftCache(int var1) {
- this.hash = new HashMap(var1);
- }
-
- public SoftCache() {
- this.hash = new HashMap();
- }
-
- public int size() {
- return this.entrySet().size();
- }
-
- public boolean isEmpty() {
- return this.entrySet().isEmpty();
- }
-
- public boolean containsKey(Object var1) {
- return sun.misc.SoftCache.ValueCell.access$300(this.hash.get(var1), false) != null;
- }
-
- protected Object fill(Object var1) {
- return null;
- }
-
- public Object get(Object var1) {
- this.processQueue();
- Object var2 = this.hash.get(var1);
- if (var2 == null) {
- var2 = this.fill(var1);
- if (var2 != null) {
- this.hash.put(var1, sun.misc.SoftCache.ValueCell.access$400(var1, var2, this.queue));
- return var2;
- }
- }
-
- return sun.misc.SoftCache.ValueCell.access$300(var2, false);
- }
-
- public Object put(Object var1, Object var2) {
- this.processQueue();
- ValueCell var3 = sun.misc.SoftCache.ValueCell.access$400(var1, var2, this.queue);
- return sun.misc.SoftCache.ValueCell.access$300(this.hash.put(var1, var3), true);
- }
-
- public Object remove(Object var1) {
- this.processQueue();
- return sun.misc.SoftCache.ValueCell.access$300(this.hash.remove(var1), true);
- }
-
- public void clear() {
- this.processQueue();
- this.hash.clear();
- }
-
- private static boolean valEquals(Object var0, Object var1) {
- return var0 == null ? var1 == null : var0.equals(var1);
- }
-
- public Set entrySet() {
- if (this.entrySet == null) {
- this.entrySet = new EntrySet(this, (1)null);
- }
-
- return this.entrySet;
- }
-
- // $FF: synthetic method
- static ReferenceQueue access$500(SoftCache var0) {
- return var0.queue;
- }
-
- // $FF: synthetic method
- static boolean access$600(Object var0, Object var1) {
- return valEquals(var0, var1);
- }
-
- // $FF: synthetic method
- static Map access$700(SoftCache var0) {
- return var0.hash;
- }
-
- // $FF: synthetic method
- static void access$800(SoftCache var0) {
- var0.processQueue();
- }
- }
-